{extend name="public/base"/}
{block name="style"}
{/block}
{block name="content"}
    <div class="data-list" data-url="{:url('index')}">
        <form class="layui-form inline-form">
            <div class="pull-left">
                <div class="layui-inline">
                    <select name="admin_id" lay-search lay-filter="data-list">
                        <option value="">所有用户</option>
                        {foreach $admin as $a}
                        <option value="{$a.id}">{$a.username}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-inline">
                    <input class="layui-input" autocomplete="off" name="tablename" placeholder="表名">
                </div>
                <div class="layui-inline">
                    <input class="layui-input laydate-range" autocomplete="off" name="date" placeholder="删除时间">
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layui-btn-sm layui-btn-normal search"><i class="layui-icon layui-icon-search"></i></button>
                </div>
            </div>
            <div class="pull-right">
                <div class="layui-inline">
                    <button type="button" class="layui-btn recover-btn layui-btn-normal layui-btn-sm"><i class="layui-icon layui-icon-refresh-1"></i> 批量恢复</button>
                </div>
            </div>
        </form>
        <div class="data">
            <p><i class="fa fa-spinner fa-spin"></i> 加载中...</p>
        </div>
    </div>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use(['form'], function ()
    {
        $(".recover-btn").click(function()
        {
            var $input = $("input.trash-id:checked");
            if($input.length < 1)
            {
                layer.msg("请勾选要恢复的数据");
                return false;
            }
            layer.load(0, {shade: false});
            var ids = [];
            $input.each(function()
            {
                ids.push($(this).val());
            });
            $.get("{:url('system/trash/recover')}", {ids:ids.join(",")}).done(function(response)
            {
                layer.closeAll('loading');
                layer.msg(response.msg);
                $('.data-list').getList();
            });
        });
    });
</script>
{/block}